#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;
int main() {
    int n;
    cin >> n;
    int num1 = 0, num2 = 0;
    for (int i = n / 2; i >= 2; i--)
    {
        int flag = 1;
        for (int j = 2; j < i; j++)
        {
            if (i % j == 0)
            {
                flag = 0;
                break;
            }
        }
        if (flag)
        {
            num1 = i;
            num2 = n - num1;
            break;
        }
    }
    cout << num1 << endl;
    cout << num2 << endl;
}